#include "feature.h"
#include "feature_task.h"

DEFINE_string(img_folder, "D:/images/blur-bikes", "img filefold path");
DEFINE_string(img_types, "ppm pgm jpg", "img types");

int main(int argc, char** argv) {
  google::ParseCommandLineFlags(&argc, &argv, true);
  google::InitGoogleLogging(argv[0]);
  FLAGS_logtostderr = true;
  FLAGS_v = 2;

  LOG(INFO) << "image path: " << FLAGS_img_folder;

  ImgCollectionTask imgs_task;
  imgs_task.LoadImgFileNames(FLAGS_img_folder, FLAGS_img_types);
  std::vector<float> thres;
  for (float beg = 0.1; beg < 30.0; beg += 0.3) { thres.push_back(beg); }
  imgs_task.LoadThresVec(thres);

  // for guided match task
  std::string guided_result_file{FLAGS_img_folder + "/geometry_guided.txt"};
  std::ofstream ofs(guided_result_file);
  if (!ofs.is_open()) {
    LOG(ERROR) << "open file fail: " << guided_result_file;
    return 0;
  }
  imgs_task.LoadHomograhpy(FLAGS_img_folder);
  //imgs_task.GuidedMatchTask(&(ImgCollectionTask::SiftGuidedMatch), ofs, false);
  imgs_task.GuidedMatchTask(&(ImgCollectionTask::GeometryGuidedMatch), ofs, false);

}